/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author damfercer
 */
@Entity
@Table(name = "tipo_ticket")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TipoTicket.findAll", query = "SELECT t FROM TipoTicket t"),
    @NamedQuery(name = "TipoTicket.findByIdTipoTicket", query = "SELECT t FROM TipoTicket t WHERE t.idTipoTicket = :idTipoTicket"),
    @NamedQuery(name = "TipoTicket.findByDescripcion", query = "SELECT t FROM TipoTicket t WHERE t.descripcion = :descripcion")})
public class TipoTicket implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_TIPO_TICKET")
    private Integer idTipoTicket;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "DESCRIPCION")
    private String descripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoTicket")
    private List<Ticket> ticketList;

    public TipoTicket() {
    }

    public TipoTicket(Integer idTipoTicket) {
        this.idTipoTicket = idTipoTicket;
    }

    public TipoTicket(Integer idTipoTicket, String descripcion) {
        this.idTipoTicket = idTipoTicket;
        this.descripcion = descripcion;
    }

    public Integer getIdTipoTicket() {
        return idTipoTicket;
    }

    public void setIdTipoTicket(Integer idTipoTicket) {
        this.idTipoTicket = idTipoTicket;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    @XmlTransient
    public List<Ticket> getTicketList() {
        return ticketList;
    }

    public void setTicketList(List<Ticket> ticketList) {
        this.ticketList = ticketList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTipoTicket != null ? idTipoTicket.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoTicket)) {
            return false;
        }
        TipoTicket other = (TipoTicket) object;
        if ((this.idTipoTicket == null && other.idTipoTicket != null) || (this.idTipoTicket != null && !this.idTipoTicket.equals(other.idTipoTicket))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.TipoTicket[ idTipoTicket=" + idTipoTicket + " ]";
    }
    
}
